#include <iostream>
#include <cstdlib>
#include "SDL.h"

using namespace std;

typedef struct _point
{
	int x;
	int y;

	_point(int _x, int _y) { x = _x; y = _y; }

}point;

int main (int argc, char* args[]) 
{
	cout << "Fuck yeah!" << endl;

	if( (SDL_Init(SDL_INIT_EVERYTHING)) == -1 )
	{
		cout << "Fuck!" << endl;
		return -1;
	}

	SDL_Surface *screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN);
	
	SDL_Rect rect;
    rect.x = rand () % (640);
    rect.y = rand () % (480);
    rect.w = rand () % (640 - rect.x);
    rect.h = rand () % (480 - rect.y);

	SDL_FillRect(screen, &rect,
                 SDL_MapRGB(screen->format, rand() % 256,
                 rand() % 256, rand() % 256)) ;

	int cnt = 0;
	while(++cnt < 30000)
	{
		if( (cnt % 24) == 0 )
		{
			rect.x = rand () % (640);
			rect.y = rand () % (480);
			rect.w = rand () % (640 - rect.x);
			rect.h = rand () % (480 - rect.y);

			SDL_FillRect(screen, &rect,
						 SDL_MapRGB(screen->format, rand() % 256,
						 rand() % 256, rand() % 256)) ;
		}

		SDL_UpdateRect(screen, 0, 0, 0, 0);
	}



	SDL_Quit();

	return 0;
}